﻿using System;
using System.Collections.Generic;

namespace Example4
{
    class Program
    {
        static void Main(string[] args)
        {
            // create a Linked List with a header node
            SortOf.LinkedList<String> list = new SortOf.LinkedList<String>("header");

            // create 5 nodes
            SortOf.LinkedListNode<String> appel = new SortOf.LinkedListNode<String>("appel");
            SortOf.LinkedListNode<String> banaan = new SortOf.LinkedListNode<String>("banaan");
            SortOf.LinkedListNode<String> citroen = new SortOf.LinkedListNode<String>("citroen");
            SortOf.LinkedListNode<String> kers = new SortOf.LinkedListNode<String>("kers");
            SortOf.LinkedListNode<String> limoen = new SortOf.LinkedListNode<String>("limoen");

            // insert the nodes into the list
            list.Insert("appel", "header");
            list.Insert("banaan", "appel");
            list.Insert("citroen", "banaan");
            list.Insert("kers", "citroen");
            list.Insert("limoen", "kers");

            // show the Linked List
            Console.WriteLine("Chapter 11: Linked List");
            Console.WriteLine();
            Console.WriteLine("The list:");
            Console.WriteLine();
            list.PrintList();
            Console.WriteLine();

            // remove the 'banaan' node
            Console.WriteLine("Removing 'banaan'...");
            Console.WriteLine();
            list.Remove("banaan");

            // show the Linked List with 'banaan' removed
            list.PrintList();
            Console.WriteLine();

            // add the 'meloen' node after 'kers'
            Console.WriteLine("Inserting 'meloen' after kers...");
            Console.WriteLine();
            list.Insert("meloen", "kers");

            // show the Linked List with 'meloen' added
            list.PrintList();
            Console.WriteLine();

            Console.WriteLine();
            Console.ReadKey();
        }
    }
}
